package com.supplychain.scm.core.basis.enums;

import com.supplychain.scm.core.basis.util.EnumUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.io.Serializable;
import java.util.Arrays;

/**
 * @author liyang
 * @version 1.0.0
 * @ClassName ProductInfoEnum
 * @createTime 14:41:00 2023/12/27
 */
@AllArgsConstructor
public enum ProductInfoEnum implements IBaseEnum<String,String> {
    SUPPLY("supply","供应链")
    ;
    /**
     * 产品名称
     */
    private final String productName;
    /**
     * 产品中文名称
     */
    private final String productCnName;


    @Override
    public String getValue() {
        return this.productName;
    }

    @Override
    public String getDescribe() {
        return this.productCnName;
    }
    /**
     * 匹配枚举值
     *
     * @param productName 产品名称
     * @return ProductInfoEnum
     */
    public static ProductInfoEnum of(String productName) {
        return Arrays.stream(ProductInfoEnum.values()).filter(productInfoEnum -> EnumUtils.eq(productInfoEnum,productName)).findFirst().orElse(null);
    }
}
